import java.io.Serializable;


public class Cards {
	abstract public static class Card implements Serializable {
		public Object owner;
		public String name;
		abstract public void startround();
	}
	abstract public static class ImprovementCard extends Card {
		public int points;
		public int woodcost;
		public int reedcost;
		public int stonecost;
		public int claycost;
	}
	//Improvements
	public static class Well extends ImprovementCard {
		private int counter;
		public Well() {
			name = "Well";
			counter = 5;
			points = 4;
			woodcost = 1;
			stonecost = 3;
			claycost = 0;
			reedcost = 0;
		}
		public void startround() {
			counter--;
			if (counter > 0) {
				((FarmBoard)owner).player.food++;
			}
		}
	}
	public static class FireplaceCheap extends ImprovementCard {
		//V/S/B=2 C = 3 bake as many 1=2
		public FireplaceCheap(){
			name ="FireplaceCheap";
			points = 1;
			claycost = 2;
			reedcost = woodcost = stonecost = 0;
		}
		public void startround(){
		}
	}
	public static class FireplaceExp extends ImprovementCard{
		//V=S=B=2 C = 3 bake as many 1 = 2
		public FireplaceExp(){
			name = "FireplaceExp";
			points = 1;
			claycost = 3;
			reedcost=woodcost=stonecost=0;
		}
		public void startround(){
		}
	}
	public static class ClayOven extends ImprovementCard{
		//bake only 1 = 5
		public ClayOven(){
			name = "ClayOven";
			points=2;
			claycost = 3;
			stonecost = 1;
			woodcost = 0;
			reedcost = 0;
		}
		public void startround(){
		}
	}
	public static class StoneOven extends ImprovementCard{
		//bake 1 = 4 or 2 = 8
		public StoneOven(){
			name = "StoneOven";
			points = 3;
			claycost =1;
			stonecost = 3;
			woodcost = reedcost = 0;
		}
		public void startround(){
		}
	}
	public static class HearthCheap extends ImprovementCard{
		//veg=3 s=2 b=3 c=4 bake asmany 1 = 3
		public HearthCheap(){
			name = "HearthCheap";
			points=1;
			claycost = 4;
			woodcost = 0;
			stonecost = 0;
			reedcost = 0;
		}
		public void startround(){
		}
	}
	public static class HearthExp extends ImprovementCard{
		//V=3 S=2 B-3 C=4, bake asmany 1=3
		public HearthExp(){
			name = "HearthExp";
			points = 1;
			claycost = 5;
			woodcost = stonecost = reedcost = 0;
		}
		public void startround(){
		}
	}
	public static class Joinery extends ImprovementCard{
		//endgame 1/2/3 points for 3/5/7 wood, only 1 wood to 2 food at harvest
		public Joinery(){
			name = "Joinery";
			points = 2;
			stonecost = woodcost = 2;
			claycost = reedcost = 0;
		}
		public void startround(){
		}
	}
	public static class Pottery extends ImprovementCard{
		// endgame 1/2/3 points for 3/5/7 clay, only 1 clay to 2 food at harvest
		public Pottery(){
			name = "Pottery";
			points = 2;
			claycost = stonecost = 2;
			woodcost = reedcost = 0;
		}
		public void startround(){
		}
	}
	public static class Reedery extends ImprovementCard{
		//endgame 1/2/3 points for 2/4/5 reed, only 1 to 3 food at harvest
		public Reedery(){
			name = "Reedery";
			points = 2;
			reedcost = 2;
			stonecost = 2;
			woodcost = 0;
			claycost = 0;
		}
		public void startround(){
		}
	}
	public static class Begger extends ImprovementCard{
		//one for each food you miss by
		public Begger(){
			name = "Begger";
			points = -3;
		}
		public void startround(){
		}
	}
	
	abstract public static class ActionCard extends Card {
		boolean taken;
		public void startround() {
			taken = false;
		}
		abstract public boolean action(Player p);
	}
	//action cards
	public static class Fishing extends ActionCard {
		private int foodcount ;
		public Fishing() {
			name = "Fishing";
			foodcount = 0;
		}
		public void startround() {
			foodcount++;
		}
		public boolean action(Player p) {
			p.food += foodcount;
			foodcount = 0;
			taken = true;
			return true;
		}
		
	}
	public static class PickTwo extends ActionCard {
		public PickTwo() {
			name = "PickTwo";
			
		}
		public void startround(){
			
		}
		public boolean action(Player p) {
			//TODO pick2
			taken = true;
			return true;
		}
	}
	public static class PickOne extends ActionCard{
		public PickOne(){
			name = "PickOne";
		}
		public void startround(){
			
		}
		public boolean action(Player p){
			//TODO pick1
			taken = true;
			return true;
		}
	}
	public static class OneWood extends ActionCard{
		private int woodcount;
		public OneWood(){
			name = "OneWood";
			woodcount = 0;
		}
		public void startround(){
			woodcount++;
		}
		public boolean action(Player p){
			p.wood+=woodcount;
			woodcount = 0;
			taken = true;
			return true;
		}
	}
	public static class TwoWood extends ActionCard{
		private int woodcount;
		public TwoWood(){
			name = "TwoWood";
			woodcount=0;
		}
		public void startround(){
			woodcount+=2;
		}
		public boolean action(Player p){
			p.wood+=woodcount;
			woodcount=0;
			taken = true;
			return true;
		}
	}

	public static class ThreeWood extends ActionCard{
		private int woodcount;
		public ThreeWood(){
			name = "ThreeWood";
			woodcount=0;
		}
		public void startround(){
			woodcount+=3;
		}
		public boolean action(Player p){
			p.wood+=woodcount;
			woodcount=0;
			taken = true;
			return true;
		}
	}
	public static class FourWood extends ActionCard{
		private int woodcount;
		public FourWood(){
			name = "FourWood";
			woodcount = 0;
		}
		public void startround(){
			woodcount+=4;
		}
		public boolean action(Player p){
			p.wood+=woodcount;
			woodcount=0;
			taken = true;
			return true;
		}
	}
	public static class OneClay extends ActionCard{
		private int claycount;
		public OneClay(){
			name = "OneClay";
			claycount=0;
		}
		public void startround(){
			claycount++;
		}
		public boolean action(Player p){
			p.clay+=claycount;
			claycount=0;
			taken=true;
			return true;
		}
	}
	public static class TwoClay extends ActionCard{
		private int claycount;
		public TwoClay(){
			name = "TwoClay";
			claycount = 0;
		}
		public void startround(){
			claycount+=2;
		}
		public boolean action(Player p){
			p.clay+=claycount;
			claycount=0;
			taken = true;
			return true;
		}
	}
	public static class ThreeClay extends ActionCard{
		private int claycount;
		public ThreeClay(){
			name = "ThreeClay";
			claycount = 0;
		}
		public void startround(){
			claycount +=3;
		}
		public boolean action(Player p){
			p.clay+=claycount;
			claycount = 0;
			taken = true;
			return true;
		}
	}
	public static class TravelingPlayers extends ActionCard{
		private int foodcount;
		public TravelingPlayers(){
			name = "TravelingPlayers";
			foodcount=0;
		}
		public void startround(){
			foodcount++;
		}
		public boolean action(Player p){
			p.food+=foodcount;
			foodcount=0;
			taken = true;
			return true;
		}
	}
	public static class BuildorFood extends ActionCard{
		private int foodcount;
		public BuildorFood(){
			name = "BuildorFood";
			foodcount = 0;
		}
		public void startround(){
			foodcount++;
		}
		public boolean action(Player p){
			//todo
			return true;
		}
	}
	public static class AnimalFood extends ActionCard{
		public AnimalFood(){
			name = "AnimalFood";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//take 1 sheep and 1 food OR 1 boar OR pay 1 food and take a cattle
			return true;
		}
	}
	public static class ReedStock extends ActionCard{
		private int reedcount;
		public ReedStock(){
			name = "ReedStock";
			reedcount = 0;
		}
		public void startround(){
			reedcount++;
		}
		public boolean action(Player p){
			p.reed+=reedcount;
			p.wood++;
			p.stone++;
			return true;
		}
	}
	public static class Pick2orFamilyGrow extends ActionCard{
		//starting round 5 can family grow with room.
		public Pick2orFamilyGrow(){
			name = "Pick2orFamilyGrow";
		}
		public void startround(){		
		}
		public boolean action(Player p){
			return true;
			//todo
		}
	}
	public static class OneSheep extends ActionCard{
		private int sheepcount;
		public OneSheep(){
			name = "OneSheep";
			sheepcount = 0;
		}
		public void startround(){
			sheepcount++;
		}
		public boolean action(Player p){
			//tadah
			sheepcount = 0;
			taken = true;
			return true;
		}
	}
	public static class OneBoar extends ActionCard{
		private int boarcount;
		public OneBoar(){
			name = "OneBoar";
			boarcount = 0;
		}
		public void startround(){
			boarcount++;
		}
		public boolean action(Player p){
			//TODO 
			boarcount = 0;
			taken = true;
			return true;
		}
	}
	public static class OneCattle extends ActionCard{
		private int cattlecount;
		public OneCattle(){
			name = "OneCattle";
			cattlecount = 0;
		}
		public void startround(){
			cattlecount++;
		}
		public boolean action(Player p){
			//Todo
			cattlecount = 0;
			taken = true;
			return true;
		}
	}
	public static class OneStone extends ActionCard{
		private int stonecount;
		public OneStone(){
			name = "OneStone";
			stonecount = 0;
		}
		public void startround(){
			stonecount++;
		}
		public boolean action(Player p){
			p.stone+=stonecount;
			stonecount = 0;
			taken = true;
			return true;
		}
	}
	public static class OneReed extends ActionCard{
		private int reedcount;
		public OneReed(){
			name = "OneReed";
			reedcount = 0;
		}
		public void startround(){
			reedcount++;
		}
		public boolean action(Player p){
			p.reed+=reedcount;
			reedcount = 0;
			taken = true;
			return true;
		}
	}
	public static class OneMajMin extends ActionCard{
		public OneMajMin(){
			name = "OneMajMin";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo pickimprove
			taken = true;
			return true;
		}
	}
	public static class FoodReedStone extends ActionCard{
		public FoodReedStone(){
			name = "FoodReedStone";
		}
		public void startround(){
		}
		public boolean action(Player p){
			p.reed++;
			p.stone++;
			p.food++;
			taken = true;
			return true;
		}
	}
	public static class StartingPlayer extends ActionCard{
		private int foodcount;
		public StartingPlayer(){
			name = "StartingPlayer";
			foodcount = 0;
		}
		public void startround(){
			foodcount++;
		}
		public boolean action(Player p){
			p.food+=foodcount;
			//Todo
			foodcount = 0;
			taken = true;
			return true;
		}
	}
	public static class Renovatethen1majmin extends ActionCard{
		public Renovatethen1majmin(){
			name = "Renovatethen1majmin";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class RenovateThenFences extends ActionCard{
		public RenovateThenFences(){
			name = "RenovateThenFences";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class BuildHomeandorStables extends ActionCard{
		public BuildHomeandorStables(){
			name = "BuildHomeandorStables";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class BuildStableandorBake extends ActionCard{
		public BuildStableandorBake(){
			name = "BuildStableandorBake";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class BuildFences extends ActionCard{
		public BuildFences(){
			name = "BuildFences";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class Plow extends ActionCard{
		public Plow(){
			name = "Plow";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class PlowandorSow extends ActionCard{
		public PlowandorSow(){
			name = "PlowandorSow";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class SowandorBake extends ActionCard{
		public SowandorBake(){
			name = "SowandorBake";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//todo
			taken = true;
			return true;
		}
	}
	public static class FamilyGrowththen1minor extends ActionCard{
		public FamilyGrowththen1minor(){
			name = "FamilyGrowththen1minor";
		}
		public void startround(){
		}
		public boolean action(Player p){
			taken = true;
			if( p.addperson()) {
				return true;
			} else {
				return false;
			}
		}
	}
	public static class FamilyGrowthAnytime extends ActionCard{
		public FamilyGrowthAnytime(){
			name = "FamilyGrowthAnytime";
		}
		public void startround(){
		}
		public boolean action(Player p){
			//p.addperson();
			taken = true;
			return true;
		}
	}
	public static class DayLabor extends ActionCard{
		public DayLabor(){
			name = "DayLabor";
		}
		public void startround(){
		}
		public boolean action(Player p){
			p.food++;
			//pickone
			taken = true;
			return true;
		}
	}
	public static class TakeWheat extends ActionCard{
		public TakeWheat(){
			name = "TakeWheat";
		}
		public void startround(){
		}
		public boolean action(Player p){
			p.wheat++;
			taken = true;
			return true;
		}
	}
	public static class TakeVeg extends ActionCard{
		public TakeVeg(){
			name = "TakeVeg";
		}
		public void startround(){
		}
		public boolean action(Player p){
			p.veggie++;
			taken = true;
			return true;
		}
	}
}
